<!--
	作者：ZhangXin
	时间：2020-07-20
	描述：博客首页面
-->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:replace="fragments::head(~{::title})">
    <title>首页</title>
</head>

<body class="index-body">
<!--导航-->
<nav th:replace="fragments::menu(1)"></nav>

<!--中间内容-->
<div class="m-container m-padded-tb-big m-opacity-mini">
    <div class="ui container">
        <div class="ui stackable grid">
            <!--左边博客列表-->
            <div class="eleven wide column">
                <!--header  -->
                <div class="ui top attached segment">
                    <div class="ui middle aligned two column grid">
                        <div class="column">
                            <h3 class="ui blue header">博客</h3>
                        </div>
                        <div class="right aligned column">
                            共
                            <h2 class="ui orange header m-inline-block m-text-thin" th:text="${page.totalElements}"> 14 </h2>篇
                        </div>
                    </div>
                </div>
                <!--content-->
                <div class="ui attached  segment">
                    <div class="ui  padded  vertical segment m-padded-tb-large" th:each="blog :${page.content}">
                        <div class="ui middle aligned mobile reversed stackable grid" >
                            <div class="eleven wide column">
                                <h2 class="ui header" ><a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black" th:text="${blog.title}">标题</a></h2>
                                <p class="m-text" th:text="|${blog.description}......|">Spring Boot 是由 Pivotal 团队提供的全新框架。Spring Boot 是所有基于 Spring Framework
                                    5.0 开发的项目的起点。Spring Boot 的设计是为了让你尽可能快的跑起来 Spring 应用程序并且尽可能减少你的配置文件。
                                </p>
                                <div class="ui grid">
                                    <div class="eleven wide column">
                                        <div class="ui mini horizontal link list">
                                            <div class="item">
                                                <img th:src="@{${blog.user.avatar}}" src="../static/images/001.jpg" alt=""
                                                     class="ui avatar image"/>
                                                <div class="content">
                                                    <a href="#" class="header" th:text="${blog.user.nickname}">ZhangXin</a>
                                                </div>
                                            </div>
                                            <div class="item">
                                                <i class="calendar icon"></i><span  th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2020-07-20</span>
                                            </div>
                                            <div class="item">
                                                <i class="eye icon"></i><span th:text="${blog.views}">1234</span>
                                            </div>
                                            <div class="item">
                                                <i class="comment outline icon"></i> <span th:text="${blog.comments.size()}">2222</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="right attached five wide column">
                                        <a href="#"
                                           class="ui teal basic label m-padded-mini m-text-thin" th:href="@{/types/{id}(id=${blog.type.id})}" th:text="${blog.type.name}">
                                            SpringBoot
                                        </a>
                                    </div>
                                </div>

                            </div>
                            <div class="five wide column">
                                <a href="#" target="_blank" th:href="@{/blog/{id}(id=${blog.id})}">
                                    <img src="../static/images/001.jpg"  th:src="@{${blog.firstPicture}}" alt=""
                                         class="ui rounded image"/>
                                </a>
                            </div>
                        </div>
                    </div>

                </div>

                <!--footer-->
                <div class="ui bottom attached segment">
                    <div class="ui middle aligned two column grid" th:if="${page.totalPages}>1">
                        <div class="column">
                            <a href="#" class="ui mini blue basic button" th:href="@{/(page=${page.number}-1)}" th:unless="${page.first}">上一页</a>
                        </div>
                        <div class="right aligned column">
                            <a href="#" class="ui mini blue basic button" th:href="@{/(page=${page.number}+1)}" th:unless="${page.last}">下一页</a>
                        </div>
                    </div>
                </div>
            </div>
            <!--右边top-->
            <div class="five wide column">
                <!--分类 -->
                <div class="ui segments">
                    <div class="ui secondary segment">
                        <div class="ui two column grid">
                            <div class="column">
                                <i class="idea icon"></i>分类
                            </div>
                            <div class="right aligned column">
                                <a href="" th:href="@{/types/-1}">more<i class="angle double right icon" ></i></a>
                            </div>
                        </div>
                    </div>
                    <div class="ui blue segment">
                        <div class="ui fluid vertical menu">
                            <a href="#" class="item" th:href="@{/types/{id}(id=${type.id})}" th:each="type:${types}">
                              <span th:text="${type.name}">Java 基础</span>
                                <div class="ui  blue basic left pointing label" th:text="${#arrays.length(type.blogs)}">13</div>
                            </a>

                        </div>
                    </div>
                </div>
                <!--标签 -->
                <div class="ui segments">
                    <div class="ui secondary segment">
                        <div class="ui two column grid">
                            <div class="column">
                                <i class="tags icon"></i>标签
                            </div>
                            <div class="right aligned column">
                                <a href="" th:href="@{/tags/-1}">more<i class="angle double right icon"></i></a>
                            </div>
                        </div>
                    </div>
                    <div class="ui blue segment">
                        <a href="#" class="ui  blue basic left pointing label m-margin-tb-tiny" th:each="tag:${tags}" th:href="@{/tags/{id}(id=${tag.id})}">
                            <span th:text="${tag.name}">框架</span>
                            <div class="detail" th:text="${#arrays.length(tag.blogs)}">23</div>
                        </a>
                    </div>
                </div>
                <!--最新推荐 -->
                <div class="ui segments">
                    <div class="ui secondary segment">
                        <div class="column">
                            <i class="bookmark icon"></i>最新推荐
                        </div>
                    </div>
                    <div class="ui segment" th:each="recommendBlog:${recommendBlogs}">
                        <a href="#" target="_blank" class=" m-black m-text-thin" th:text="${recommendBlog.title}" th:href="@{/blog/{id}(id=${recommendBlog.id})}">SpringBoot快速入门</a>
                    </div>
                </div>
                <!--二维码 -->
                <div class="ui segment">
                    <div class="ui header m-margin-tb-tiny" style="font-weight: bold;color: #F08047;font-family: STSong;text-align: center">打赏本站</div>
                    <div class="ui orange basic label">
                        <div class="ui  images" style="font-size: inherit !important;">
                            <div class="image">
                                <img src="../static/images/alipay.png" th:src="@{/images/alipay.png}" alt="" class="ui rounded bordered image" style="width: 110px">
                                <div style="text-align: center">支付宝</div>
                            </div>
                            <div class="image" style="float: right">
                                <img src="../static/images/wechatpay.png" th:src="@{/images/wechatpay.png}" alt="" class="ui rounded bordered image" style="width: 110px">
                                <div style="text-align: center">微信</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--底部内容-->
<footer th:replace="fragments::footer"></footer>

<script th:replace="fragments::script"></script>

<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide')
    })


    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-show');

    });

</script>
</body>

</html>